{% extends "base.html" %}
{% load staticfiles %}

{% block title %}
	图灵课程 - 添加单选题
{% endblock %}

{% block style %}
    <style type="text/css">
        .pre-scrollable{
            max-height: 340px;
            overflow-y: scroll;
        }
        .error_msg{
            color:red;
        }
    </style>
{% endblock %}

{% block content %}
<!--test log in-->
<div id="modifyDiv" style="position:fixed;
display:none;
width:100%;
height:100%;
z-index:9999;
opacity:0.6;
background-color: white;
top:0;
left:0;">
</div>
<div id="modifyReg" style="position: absolute;
    display: none;
    left: 30%;
    top: 60%;
    background: white;
    width: 40%;
    height: auto;
    border: 3px solid #444;
    border-radius: 7px;
    z-index: 10000;">
    <div style="margin: 10px 10px; padding-top:50px; padding-bottom:50px;  text-align: center;">
        <div id="ModifyJudgementProblem" style="display: none;">
        <h2 class="form-signin-heading" style="padding-bottom: 10px">Modify Judgement Problem</h2>
            <div class="item">
                <div class="reg_mess">
                <span class="glyphicon glyphicon-user"></span>*题目:</div>
                <div class="reg_mess_input">
                <textarea cols="40" id="id_judgementtitle" name="judgementtitle" rows="10"></textarea>
                <span id="judgementtitle_remind" style="display:none;" class="error_msg1"></span>
                </div>

                <div class="clear"></div>
            </div>
        <div class="item">
            <div class="reg_mess">
            <span class="glyphicon glyphicon-lock"></span>*答案:</div>
            <div class="reg_mess_input">
            <select id="id_judgementanswer" name="judgementanswer">
            <option value="A">True</option>
            <option value="B">False</option>
            </select>
            <div id="judgementanswer_remind" class="error_msg1" style="display:none;"></div>
            </div>

            <div class="clear"></div>
        </div><div class="item">
        <div class="reg_mess">
        <span class="glyphicon glyphicon-user"></span>*解析:</div>
            <div class="reg_mess_input">
            <textarea cols="40" id="id_analysis" name="analysis" rows="10"></textarea>
            <span id="analysis_remind" style="display:none;" class="error_msg1"></span>
            </div>

            <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>*分值:</div>
            <div class="reg_mess_input">
            <input id="id_weight" name="weight" type="number">
            <div id="weight_remind" class="error_msg1" style="display:none;"></div>
            </div>

            <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>备注:</div>
            <div class="reg_mess_input">
            <input id="id_note" maxlength="200" name="note" type="text">
            <div id="note_remind" class="error_msg1" style="display:none;"></div>
            </div>

            <div class="clear"></div>
        </div><div class="item">

            <div class="clear"></div>
        </div><div style="margin-padding: 20px">
                </div><table  style="margin-left:40%">
            <tbody><tr>
                    <td>
                        <p style="width=15px">&nbsp;</p>
                    </td>

                    <td>
                         <button id="JudgementProblemFinish" class="upload-button" >完成修改</button>
                    </td>

                </tr>

        </tbody></table>
    </div>
        <div id="ModifySingleProblem" style="display: none;">
        <h2 class="form-signin-heading" style="padding-bottom: 10px">Modify Single Problem</h2>
        <div class="item">
        <div class="reg_mess">
        <span class="glyphicon glyphicon-user"></span>*题目:</div>
             <div class="reg_mess_input">
             <textarea cols="40" id="id_singletitle" name="singletitle" rows="10"></textarea>
             <span id="singletitle_remind" style="display:none;" class="error_msg1"></span>
             </div>

             <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>*选项A:</div>
             <div class="reg_mess_input">
             <input id="id_optionA" maxlength="500" name="optionA" type="text">
             <div id="optionA_remind" class="error_msg1" style="display:none;"></div>
             </div>

             <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>*选项B:</div>
             <div class="reg_mess_input">
             <input id="id_optionB" maxlength="500" name="optionB" type="text">
             <div id="optionB_remind" class="error_msg1" style="display:none;"></div>
             </div>

             <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>*选项C:</div>
             <div class="reg_mess_input">
             <input id="id_optionC" maxlength="500" name="optionC" type="text">
             <div id="optionC_remind" class="error_msg1" style="display:none;"></div>
             </div>

             <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>*选项D:</div>
             <div class="reg_mess_input">
             <input id="id_optionD" maxlength="500" name="optionD" type="text">
             <div id="optionD_remind" class="error_msg1" style="display:none;"></div>
             </div>

             <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>*答案:</div>
             <div class="reg_mess_input">
             <select id="id_singleanswer" name="singleanswer">
        <option value="A">A</option>
        <option value="B">B</option>
        <option value="C">C</option>
        <option value="D">D</option>
        </select>
             <div id="singleanswer_remind" class="error_msg1" style="display:none;"></div>
             </div>

             <div class="clear"></div>
        </div><div class="item">
        <div class="reg_mess">
        <span class="glyphicon glyphicon-user"></span>*解析:</div>
             <div class="reg_mess_input">
             <textarea cols="40" id="id_analysis" name="analysis" rows="10"></textarea>
             <span id="analysis_remind" style="display:none;" class="error_msg1"></span>
             </div>

             <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>*分值:</div>
             <div class="reg_mess_input">
             <input id="id_weight" name="weight" type="number">
             <div id="weight_remind" class="error_msg1" style="display:none;"></div>
             </div>

             <div class="clear"></div>
        </div><div class="item"><div class="reg_mess">
        <span class="glyphicon glyphicon-lock"></span>备注:</div>
             <div class="reg_mess_input">
             <input id="id_note" maxlength="200" name="note" type="text">
             <div id="note_remind" class="error_msg1" style="display:none;"></div>
             </div>

             <div class="clear"></div>
        </div><div class="item">

             <div class="clear"></div>
        </div><div style="margin-padding: 20px">
                     </div>
        <table  style="margin-left:40%">
             <tbody><tr>
                             <td>
                                     <p style="width=15px">&nbsp;</p>
                             </td>

                             <td>
                                 <button id="SingleProblemFinish" class="upload-button" >完成修改</button>
                             </td>

                     </tr>

        </tbody></table>
    </div>

        <button id="cancelButton" onclick="$('#cancelButton').attr('disabled','disabled');$('#modifyReg').slideToggle(500);$('#modifyDiv').css('display','none');$('#ModifySingleProblem').css('display', 'none');$('#ModifyJudgementProblem').css('display', 'none');$('.modifyQuestion').attr('disabled', false);" style="margin:0 auto;" class="upload-button">
            取消
        </button>
    </div>
</div>

<div class="container" role="main" style="width: 50%;padding: 10px">
<div style="color: inherit; padding: 15px" align="center" >
    <form action="/OnlineExam/AddSingleProblem/" method="POST" autocomplete="off">
        <h2 class="form-signin-heading" style="padding-bottom: 10px">Add Single Problem</h2>
        <table>

        <div class="item">
        <div  class="reg_mess">
        <span class="glyphicon glyphicon-user"></span>*题目:</div>
            <div class="reg_mess_input">
            {{ obj1.singletitle }}
            <span id="singletitle_remind" style="display:none;" class="error_msg1"></span>
            </div>
            {%  if obj1.errors.singletitle %}
                <div id="singletitle_error" class="error_msg">{{ obj1.errors.singletitle.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

        <div class="item"><div  class="reg_mess" >
        <span class="glyphicon glyphicon-lock"></span>*选项A:</div>
            <div class="reg_mess_input">
            {{ obj1.optionA }}
            <div id="optionA_remind" class="error_msg1" style="display:none;"></div>
            </div>
            {%  if obj1.errors.optionA %}
                <div id="optionA_error" class="error_msg">{{ obj1.errors.optionA.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

        <div class="item"><div  class="reg_mess" >
        <span class="glyphicon glyphicon-lock"></span>*选项B:</div>
            <div class="reg_mess_input">
            {{ obj1.optionB }}
            <div id="optionB_remind" class="error_msg1" style="display:none;"></div>
            </div>
            {%  if obj1.errors.optionB %}
                <div id="optionB_error" class="error_msg">{{ obj1.errors.optionB.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

		<div class="item"><div  class="reg_mess" >
        <span class="glyphicon glyphicon-lock"></span>*选项C:</div>
            <div class="reg_mess_input">
            {{ obj1.optionC }}
            <div id="optionC_remind" class="error_msg1" style="display:none;"></div>
            </div>
            {%  if obj1.errors.optionC %}
                <div id="optionC_error" class="error_msg">{{ obj1.errors.optionC.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

		<div class="item"><div  class="reg_mess" >
        <span class="glyphicon glyphicon-lock"></span>*选项D:</div>
            <div class="reg_mess_input">
            {{ obj1.optionD }}
            <div id="optionD_remind" class="error_msg1" style="display:none;"></div>
            </div>
            {%  if obj1.errors.optionD %}
                <div id="optionD_error" class="error_msg">{{ obj1.errors.optionD.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

		<div class="item"><div  class="reg_mess" >
        <span class="glyphicon glyphicon-lock"></span>*答案:</div>
            <div class="reg_mess_input">
            {{ obj1.singleanswer }}
            <div id="singleanswer_remind" class="error_msg1" style="display:none;"></div>
            </div>
            {%  if obj1.errors.singleanswer %}
                <div id="singleanswer_error" class="error_msg">{{ obj1.errors.singleanswer.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

        <div class="item">
        <div  class="reg_mess">
        <span class="glyphicon glyphicon-user"></span>*解析:</div>
            <div class="reg_mess_input">
            {{ obj1.analysis }}
            <span id="analysis_remind" style="display:none;" class="error_msg1"></span>
            </div>
            {%  if obj1.errors.analysis %}
                <div id="analysis_error" class="error_msg">{{ obj1.errors.analysis.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

        <div class="item"><div  class="reg_mess" >
        <span class="glyphicon glyphicon-lock"></span>*分值:</div>
            <div class="reg_mess_input">
            {{ obj1.weight }}
            <div id="weight_remind" class="error_msg1" style="display:none;"></div>
            </div>
            {%  if obj1.errors.weight %}
                <div id="weight_error" class="error_msg">{{ obj1.errors.weight.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

        <div class="item"><div  class="reg_mess" >
        <span class="glyphicon glyphicon-lock"></span>备注:</div>
            <div class="reg_mess_input">
            {{ obj1.note }}
            <div id="note_remind" class="error_msg1" style="display:none;"></div>
            </div>
            {%  if obj1.errors.note %}
                <div id="note_error" class="error_msg">{{ obj1.errors.note.0 }}</div>
            {% endif %}
            <div class="clear"></div>
        </div>

		<div class="item">
            {%  if obj1.non_field_errors %}
                {% for item in obj1.non_field_errors %}
                    <div class="error_msg">{{ item }}</div>
                {% endfor %}
            {% endif %}
            <div class="clear"></div>
        </div>

        <div style="margin-padding: 20px">
            <tr>
                <td>
                    <p style="width=15px">&nbsp;</p>
                </td>
                {% if not finished %}
                <td>
                    <input value="添加单选题" class="btn btn-sm btn-primary btn-block" type="submit" style="background-color: #b07675; border:none;font-size: 14px;" name="submit">
                    <input value="添加判断题" class="btn btn-sm btn-primary btn-block" type="submit" style="background-color: #b07675; border:none;font-size: 14px;" name="submit">
                </td>
                {% else %}
                <td>
                    <input value="完成" class="btn btn-sm btn-primary btn-block" type="submit" style="background-color: #b07675; border:none;font-size: 14px;" name="submit">
                </td>
                {% endif %}
            </tr>
        </div>
        </table>
    </form>

</div>
{% for question in questions %} 
<div id="{{question.QuestionID}}" class="examdetail1 ExamQuestion">
{% if question.type1 %}
<span id="id_singletitle">{{question.QuestionTitle}}</span>(<span id="id_weight">{{question.Weight}}</span>分)
<ul>
  <li>选项A：<span id="id_optionA">{{question.OptionA}}</span></li>
  <li>选项B：<span id="id_optionB">{{question.OptionB}}</span></li>
  <li>选项C：<span id="id_optionC">{{question.OptionC}}</span></li>
  <li>选项D：<span id="id_optionD">{{question.OptionD}}</span></li>
</ul>
<br>答案： <span id="id_singleanswer">{{question.Answer}}</span>
<br>解析： <span id="id_analysis">{{question.Analysis}}</span>
<br>备注： <span id="id_note">{{question.Note}}</span><br>
<br>
{% endif %}
{% if question.type2 %}
<span id="id_judgementtitle">{{question.QuestionTitle}}</span>(<span id="id_weight">{{question.Weight}}</span>分)
<ul>
  <li>选项A：True</li>
  <li>选项B：False</li>
</ul>
<br>答案： <span id="id_judgementanswer">{{question.Answer}}</span>
<br>解析： <span id="id_analysis">{{question.Analysis}}</span>
<br>备注： <span id="id_note">{{question.Note}}</span><br>
<br>
{% endif %}
<button class="modifyQuestion upload-button" id="{{question.QuestionID}}">修改</button>
</div>
<br>


{% endfor %}

</div>
{% endblock %}

{% block other_script %}

<script type="text/javascript" src="/static/js/addProblems.js"></script>

{% endblock %}
